//
//  HuongInfoCell.m
//  PhongThuyHuongNha
//
//  Created by Le Anh Tai on 10/5/13.
//  Copyright (c) 2013 Le Anh Tai. All rights reserved.
//

#import "HuongInfoCell.h"
#import "UIConstants.h"

@implementation HuongInfoCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        _subView = [[UIView alloc] init];
        _subView.backgroundColor = [UIColor clearColor];;
        [self.contentView addSubview:_subView];
        
        //
        _lineView = [[LineView alloc]init];
        [_subView addSubview:_lineView];
        
        //
        UIFont *font = FONT_HELVETICANEUE(FONT_SIZE_HEADER_RESULT - 2);
        _label = [[UILabelEx alloc] initWithTitle:@"" titleFont:font content:@"" contentFont:font];
        _label.title.textAlignment = NSTextAlignmentCenter;
        _label.content.textAlignment = NSTextAlignmentCenter;
        _label.backgroundColor = [UIColor clearColor];
        [_subView addSubview:_label];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    _subView.frame = self.contentView.bounds;
    _lineView.frame = RECT(0, 0, _subView.width, 2);
    
    _label.titleWidth = _subView.width/2;
    _label.frame = RECT(10, 0, _subView.width - 20, _subView.height);
}

- (void)setTextColor:(UIColor *)textColor
{
    _label.title.textColor = textColor;
    _label.content.textColor = textColor;
}

- (void)loadInfo:(NSArray *)info
{
    if (info == nil || info.count < 1)
    {
        return;
    }
    
    _label.title.text = [info objectAtIndex:0];
    _label.content.text = [info objectAtIndex:1];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
